package crp.core.security.domain.messages;

import com.qwlabs.exceptions.NotFoundException;
import io.quarkus.security.AuthenticationFailedException;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;

import javax.inject.Inject;

import static org.jboss.logging.Messages.getBundle;


@MessageBundle(projectCode = "CRP-SECURITY")
public interface SecurityMessages {
    @Inject
    SecurityMessages INSTANCE = getBundle(SecurityMessages.class);

    @Message(value = "账号不存在")
    AuthenticationFailedException usernameNotFound();

    @Message(value = "无效的身份凭证")
    AuthenticationFailedException invalidPrincipal();

    @Message(value = "无效的身份, name:{0}", format = Message.Format.MESSAGE_FORMAT)
    AuthenticationFailedException invalidIdentity(String name);

    @Message(value = "创建Token失败")
    AuthenticationFailedException createTokenFailed();

    @Message(value = "账号或密码错误")
    AuthenticationFailedException wrongUsernameOrPassword();

    @Message(value = "找不到该用户, id:{0}", format = Message.Format.MESSAGE_FORMAT)
    NotFoundException userNotFound(String id);

    @Message(value = "找不到该角色, id:{0}", format = Message.Format.MESSAGE_FORMAT)
    NotFoundException roleNotFound(String id);

    @Message(value = "统一身份认证失败, provider:{0}", format = Message.Format.MESSAGE_FORMAT)
    AuthenticationFailedException ssoLoginFailed(String provider);
}
